package StudyCode.summary.mycollection;

import java.util.Iterator;
import java.util.NoSuchElementException;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class EmptyIterator {
	private static final Iterator<Object> EMPTY_ITERATOR = new Iterator<Object>() {
		public boolean hasNext() {
			return false;
		}

		public Object next() {
			throw new NoSuchElementException();
		}

		public void remove() {
			throw new UnsupportedOperationException();
		}
	};

	@SuppressWarnings("unchecked")
	public static final <T> Iterator<T> emptyIterator() {
		return (Iterator<T>) EMPTY_ITERATOR;
	}
}
